package priv.pront.code.lanqiao.competition.course.date0403;

import java.util.Scanner;

public class 拦截导弹 {

    public static void main(String[] args) {
        Scanner read = new Scanner(System.in);
        String[] str = read.nextLine().split(" ");
        int[] num = new int[str.length];
        for (int i = 0; i < str.length; i++) {
            num[i] = Integer.valueOf(str[i]);
        }
        //所有数据拿到
        int[] maxLength = new int[str.length];
        int[] maxXitong = new int[str.length];
        for (int i = 0; i < str.length; i++) { //初始都赋值为1
            maxLength[i] = 1;
            maxXitong[i] = 1;
        }
        for (int i = 1; i < str.length; i++)//第几个导弹
            for (int j = 0; j < i; j++)//
            {
                if (num[j] <= num[i])//出现前面的导弹不比我们现在的导弹高，我们就需要多加一套系统下一个导弹比上一个矮或者平
                {
                    maxXitong[i] = Math.max(maxXitong[i], maxXitong[j] + 1);
                } else//如果比我们现在高，那么最长的长度就可以加1
                {
                    maxLength[i] = Math.max(maxLength[i], maxLength[j] + 1);
                }
            }
        //最后遍历两个数组，就可以得所需要的
        int count1 = Integer.MIN_VALUE;
        int count2 = Integer.MIN_VALUE;
        for (int i = 0; i < str.length; i++) {
            if (maxLength[i] > count1)
                count1 = maxLength[i];
            if (maxXitong[i] > count2)
                count2 = maxXitong[i];
        }
        System.out.println(count1);
        System.out.println(count2);
    }
}
